package com.chance.cc.crawler.development.command.meta.keyword.xy78;

import com.chance.cc.crawler.development.command.meta.keyword.CrawlerDomainKeywordCommand;
import com.chance.cc.crawler.meta.core.bean.crawler.CrawlerDomainKeys;

import java.util.ArrayList;
import java.util.List;

/**
 * @author lt
 * @version 1.0
 * @date 2021-06-16 16:21:20
 * @email okprog@sina.com
 */
public class XY78Keywords {

    /*xhs-user-test:测试关键词 - 未删除*/
    /*5d30687e00000000160068df*/
    private static final String domain = "xy78";
//    private static final String kw_site = "xhs-user-test";
    private static final String news_site = "news";
    private static final String search_site = "search";
    private static CrawlerDomainKeywordCommand crawlerDomainKeywordCommand =
            new CrawlerDomainKeywordCommand("192.168.1.217", 9599);

    private static List<String> newsKWs = new ArrayList<>();
    private static List<String> searchKWs = new ArrayList<>();
    static {
        newsKWs.add("http://news.xy178.com/jj/");
    }
    static {
        searchKWs.add("镁信");
    }

    public static void main(String[] args) {
        searchKw();
    }

    public static void newsKw(){
        for (String keyword : newsKWs) {
            CrawlerDomainKeys crawlerDomainKeys = new CrawlerDomainKeys();
            crawlerDomainKeys.setDomain(domain);
            crawlerDomainKeys.setSite(news_site);
            crawlerDomainKeys.setKeyword(keyword);
            crawlerDomainKeys.setStatus(0);
            crawlerDomainKeywordCommand.addOrUpdateKeys(crawlerDomainKeys);
//            crawlerDomainKeywordCommand.delKeys(crawlerDomainKeys);
        }
    }

    public static void searchKw(){
        for (String keyword : searchKWs) {
            CrawlerDomainKeys crawlerDomainKeys = new CrawlerDomainKeys();
            crawlerDomainKeys.setDomain(domain);
            crawlerDomainKeys.setSite(search_site);
            crawlerDomainKeys.setKeyword(keyword);
            crawlerDomainKeys.setStatus(0);
            crawlerDomainKeywordCommand.addOrUpdateKeys(crawlerDomainKeys);
//            crawlerDomainKeywordCommand.delKeys(crawlerDomainKeys);
        }
    }
}
